<?php

/*
 */

m2import('phpinchains/psp/Tag.php');

class phpinchains_psp_MethodTag extends phpinchains_psp_Tag {

    /**
     * Documents related to the one this method is used in
     *
     * @var array Related docs
     */
    protected $related_docs = array();

    function registerRelatedDocuments(base_templateEngine_DocumentContext $dctx) {
        $ctx = base_ApplicationContext::getInstance();
        $rootBuildMode = $ctx->getDocumentContext()->getRoot()->getBuildMode();
        if (count($this->related_docs)
                && ($rootBuildMode == base_templateEngine_BuildModes::$CACHE
                    || $rootBuildMode == base_templateEngine_BuildModes::$EXPORT
                    || $rootBuildMode == base_templateEngine_BuildModes::$PRINT))
            $ctx->getAccessFactory()->getInstanceOf(base_AccessFactory::$CMS)->
                addPubLinkRelations(0, $dctx->getLanguage('id'), $dctx->getRoot()->getDocId(), $this->related_docs);
        unset($this->rel_docs);
    }

}

?>